<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>查看员工信息</title>
<link rel="stylesheet" type="text/css" href="css/index.css">
    <link rel="stylesheet" type="text/css" href="themes/metro/easyui.css">  
    <link rel="stylesheet" type="text/css" href="themes/mobile.css">  
    <link rel="stylesheet" type="text/css" href="themes/icon.css">  
    <script type="text/javascript" src="js/jquery.min.js"></script>  
    <script type="text/javascript" src="js/jquery.easyui.min.js"></script> 
    <script type="text/javascript" src="js/jquery.easyui.mobile.js"></script> 
</head>
<script type="text/javascript">
$(function(){
	$("#wb").hide()
	$("#xgmm").hide()
	$('#dg').datagrid({    
	    url:'ygxx',    
	    columns:[[
	        {field:'ck',width:100,checkbox:true},
	        {field:'usernum',title:"用户名",width:90,hidden:true},
	        {field:'userpsw',title:"密码",width:90,hidden:true},
	        {field:'username',title:'姓名',width:90} ,
	        {field:'userage',title:'年龄',width:90},    
	        {field:'usersex',title:'性别',width:90},    
	        {field:'useridcard',title:'身份证号',width:110} ,
	        {field:'userborn',title:'出生日期',width:90},    
	        {field:'usernation',title:'民族',width:90},    
	        {field:'useraddress',title:'家庭住址',width:90} ,
	        {field:'usereducation',title:'学历',width:90} ,
	        {field:'userintime',title:'入职时间',width:90},    
	        {field:'userpositon',title:'职位',width:90},    
	        {field:'userremark',title:'备注',width:90} ,
	        {field:'userdepartment',title:"部门",width:90}   
	    ]],
          toolbar : [ {
		
		  iconCls : 'icon-edit',
		  text : '修改信息',
		  handler : function() {
		  var users = $('#dg').datagrid('getSelections');
              if(users.length==1){
            	 $("#wb").show()
            	  var usernum=$("#usernum").val(users[0].usernum)	
            	  var username=$("#username").val(users[0].username)
            	  var userage=$("#userage").val(users[0].userage)
            	  var usesex=$("#usersex").val(users[0].usersex)
            	  var useidcard=$("#useridcard").val(users[0].useidcard)
            	  var userborn=$("#userborn").val(users[0].userborn)
            	  var usernation=$("#usernation").val(users[0].usernation)
            	  var useraddress=$("#useraddress").val(users[0].useraddress)
            	  var usereducation=$("#usereducation").val(users[0].usereducation)
            	   $(function(){
            		   $("#win").window({
   						width : 600,
   						height : 500,
   						modal : true,
   						title : "请填写信息"
                      
   					})
            		  	$('#btn').linkbutton({
							onClick : function() {
								  var usernum=$("#usernum").val()
				            	  var username=$("#username").val()
				            	  var userage=$("#userage").val()
				            	  var usersex=$("#usersex").val()
				            	  var useidcard=$("#useridcard").val()
				            	  var userborn=$("#userborn").val()
				            	  var usernation=$("#usernation").val()
				            	  var useraddress=$("#useraddress").val()
				            	  var usereducation=$("#usereducation").val()
			
				            	  $.ajax({
				            		  url:"xiugai",
				            		  type:"post",
				                      data:{
				                    	"usernum" :usernum,
				                    	"username":username,
				                    	"userage":userage,  
				                        "usersex" :usersex,
				                        "useridcard":useidcard,
				                        "userborn" :userborn,
				                        "usernation":usernation,
				                        "useraddress":useraddress,
				                        "usereducation":usereducation,
				                      },
				            	       success:function(data){
				            	    	   if (data == "true") {
												$("#win").window("close");
												$.messager.alert('提示', '修改成功');
												$('#dg').datagrid('reload');
												
											} else {
												$.messager.show({
													title : '信息提示',
													msg : '修改失败',
													timeout : 1000,
													showType : 'slide'
												});
											}
				            	       }
				            	  })
							}
            		  	})
            	   }) 
            	  
					  
              } 
		}
	}],
	 
	});
	
	$('#tb').textbox({    
	      
	    iconAlign:'left'       
	}) 
	$("#xg").linkbutton({
		onClick:function(){
			$("#xgmm").show()
			 $("#ckou").window({
					width : 400,
					height : 300,
					modal : true,
					title : "请填写信息"
              
				})
		}
	})
    	$('#xgmm').form({    
		    url:'xgmm',
		    success:function(data){ 
		        if(data=="true"){
		        	$("#ckou").window("close");
		        	$.messager.alert('提示', '修改成功');
		        
		        }else{
		        	$.messager.show({
		        		title:'信息提示',
		        		msg:'修改失败',
		        		timeout:1000,
		        		showType:'slide'
		        	})
		        }
		    }    
		});
	
	$("#xinpsw").blur(function(){
		if($("#xinpsw").val().length<6){
			$("#sp").show()
		}else{
			$("#sp").hide()
		}
	})
	$("#qrnpsw").blur(function(){
		if($("#xinpsw").val()!=$("#qrnpsw").val()){
			$("#qr").show()
		}else{
			$("#qr").hide()
		}
	});
	
	//设置申请提交按钮 
	 $('#bt').linkbutton({
		 
			onClick:function(){
				
				$('#xgmm').submit();
			}
		});
	$("#useridcard").blur(function(card){
		 var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;  
		   if(reg.test(card) === false)  
		   {  
			   $("#sfz").show()
		       return  false;  
		   }  
		
	})
})


</script>
<body>
    <table id="dg"></table> 
    
    <div id="win">
    
    <div id="wb" style="margin-left:100px;line-height:40px">
        <input id="usernum" name="usernum" type="text" style="width:300px;display: none;">
        <br>
       
     &nbsp;姓名 :<input id="username" name="username" type="text" style="width:300px">
       <br>
    &nbsp;&nbsp;年龄:<input id="userage" name="userage" type="text" style="width:300px">
       <br>
    
     &nbsp;&nbsp;性别:<input id="usersex" name="usersex" type="text" style="width:300px">
       <br>
       
       身份证号:<input id="useridcard" name="useridcard" type="text" style="width:300px"> <span id="sfz" style="display:none;color:red">身份证格式不对</span>
      <br> 
        出生日期:<input id="userborn" name="userborn" class="easyui-datetimebox" type="text" style="width:300px">
    <br>
   
   &nbsp;&nbsp;民族:<input id="usernation" name="usernation" type="text" style="width:300px">
      <br>
    
      家庭住址:<input id="useraddress" name="useraddress" type="text" style="width:300px">
      <br>
     
     &nbsp;学历:<input id="usereducation" name="usereducation" type="text" style="width:300px">
    
    
     <br>
    
     <a id="btn" href="#" class="easyui-linkbutton" style="margin-left: 140px;">确定</a>
      </div>
    </div>
    <div id="mima" style="margin-top: 20px">
        <a id="xg" href="#" class="easyui-linkbutton" style="margin-left: 20px;">修改密码</a>
    </div>
    
    
    
    <div id="ckou">
    <form id="xgmm" method="psot">
    <div id="xgmm1" style="margin-top:20px;margin-left: 50px">
    &nbsp; &nbsp;旧密码: <input id="jiupsw" name="usernation" type="password" style="width:200px" value="${sessionScope.upsw}">
        <br>
        <br>
    <br>
  &nbsp; &nbsp;新密码: <input id="xinpsw" name="xinpsw" type="password" style="width:200px">
  <br>
    &nbsp; &nbsp;<span id="sp" style="display:none;color:red">密码必须大于5位</span>
   <br>
   <br>
    
 &nbsp;&nbsp;确认密码:<input id="qrnpsw" name="qrpsw" type="password" style="width:200px">
   <br>
    &nbsp; &nbsp;<span id="qr" style="display:none;color:red">密码必须跟上面保持一致</span>
    <br>
    <br>
     <a id="bt" href="#" class="easyui-linkbutton" style="margin-left: 30px;">确定</a>
   </div>
   </form>
   </div>
</body>
</html>